# 作者：SP
# 开发时间：2024/1/10 22:15
import json
def get_stord_username():
    '''如果存储了用户名，就读取它'''
    filename = 'usersname.json'
    try:
        with open(filename,'r') as f:
            content = json.load(f)
    except FileNotFoundError:
        return None
    else:
        return content
def greet_user():
    '''问候用户，并指出其名字'''
    name = get_stord_username()
    if name:
        print(f'hello,{name}')
    else:
        name = input('what is your name')
        filename = 'usersname.json'
        with open(filename,'a') as f:
            json.dump(name,f)
            print(f'we will remember you,{name}')
greet_user()